package jvm.quote;
import java.lang.ref.WeakReference;
/**
 * @author cyt
 * @create 2020-09-11 18:14
 */
public class Weak {
    /**
     * 弱引用， 发送GC就会被回收掉！ 不管内存够不够
     *
     * @param args
     */
    public static void main(String[] args) {

        WeakReference<User> test = new WeakReference<User>(new User(1, "@cuiyut"));
        System.out.println(test.get());
        System.gc();
        System.out.println(test.get());
    }
}
